<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/validate.jsp"%>
<%@ include file="function.jsp"%>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>查看角色</title>
    <link  href="../../hos_manage/images/favicon.ico?cache=<%=Math.random()%>" rel="shortcut icon" type="image/x-icon">
    <link rel="stylesheet" href="../css/public.css?cache=<%=Math.random()%>">
    <link rel="stylesheet" href="../css/messages_doctor_mes.css?cache=<%=Math.random()%>">
    <link rel="stylesheet" href="../css/sweetalert.css?cache=<%=Math.random()%>" >
    <link rel="stylesheet" href="../css/pageCode.css?cache=<%=Math.random()%>" />

    <script src="../js/jquery-1.9.1.min.js"></script>
</head>
<body>
    <%@ include file="../header.jsp"%>
    <!--内容-->
    <div class="containerone">
        <%@ include file="../left_menu.jsp"%>
        <!--右边内容-->
    <div class="right_cont">
    <!--右边导航下面内容-->
        <div id="role_box">
            <div class="message_hos_news_container">
                <div class="department_top">
                    <div class="department_top_left department_top_top">
                        <span>
                            <p class="padding-right-min" v-html="title"></p>
                        </span>
                    </div>
                    <div class="department_top_right ui_line_height">
                        <a href="role.jsp" >
                            <span class="add_btn doctor_add_btn " id='doctor_add_btn'>返回</span>
                        </a>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="role_box">
                    <div class="role_name">
                        <span>角色名称:</span>
                        <div class="ui_dark" v-html="role.name"></div>
                    </div>
                    <div class="role_description">
                        <span>角色描述:</span>
                        <div class="ui_dark" v-html="role.desc"></div>
                    </div>
                    <div class="power_choose_title">
                        <span>权限选择:</span>
                    </div>
                    <div class="power_choose">
                        <div class="power_choose_list">
                            <table class="three_list_choose "  cellspacing="0" cellpadding="0" border="0"   bordercolor="#cccccc" style="border-collapse:collapse;">
                                <template v-for="eachFirstMenu in menus">
                             <tbody >
                                    <tr >
                                        <td colspan="11" v-html="eachFirstMenu.name" class="ui_bg"></td>
                                    </tr>
                                    <tr v-for="eachSecondMenu in eachFirstMenu.childs"   class="ui_bottom">
                                        <td class="ui_width_one ui_bg_light" v-html="eachSecondMenu.name"></td>
                                        <td colspan="10">
                                            <span v-for="eachThirdMenu in eachSecondMenu.childs" v-html="eachThirdMenu.name + '&nbsp'"> </span>
                                        </td>
                                    </tr>
                                 </tbody>
                                </template>
                            </table>
                        </div>
                    </div>
                    <span class="herf" @click="edit_role()" v-if="role.id != ${user_role_id}">
                        <%
                            if (checkAuth("编辑角色权限", input)) {
                        %>
                        <div class="role_sure">编辑</div>
                        <%
                            }
                        %>
                    </span>
                </div>
            </div>
        </div>
    </div>
</div>
    <script src="/hos_manage/js/sweetalert-dev.js"></script>
    <script>
        new Vue({
            el: "#role_box",
            data: {
                title: "用户查看",
                role: {},
                menus: [],
            },
            methods: {
                edit_role: function() {
                    locationHerf("edit_role", {
                        role: this.role,
                        menus: this.menus
                    });
                }
            },
            ready: function() {
                if (hasHospitalPower.power()) {
                    this.title += "-" + hasHospitalPower.nowHospital.name;
                }
                this.role = getHrefParms("see_role").role;
                $.ajax({
                    type: 'POST',
                    url: "see_role.jsp",
                    data: hasHospitalPower.parms({
                        act: "role_menus",
                        role_id: this.role.id + "",
                    }),
                    success: function(res) {
                        res = JSON.parse(res);
                        if (res.errcode == 0) {
                            this.menus = res.data;
                        } else {
                            swal(res.errmsg);
                        }
                    }.bind(this),
                });
            }
        });
    </script>
</body>
</html>
